<template>
  <!-- 新建编辑弹框 -->
  <base-modal :show.sync="visible" :title="dialogTitle" width="600px" class="project-type-work-log-dialog" @closed="closeDialog">
    <div class="base-modal-content">
      <form-view v-if="fields.length" :fields="fields" :value="form">
      </form-view>
    </div>
    <div slot="footer" class="dialog-footer">
      <el-button @click="visible = false">{{$t('common.base.makeSure')}}</el-button>
    </div>
  </base-modal>
</template>
<script>
import { reactive, toRefs } from 'vue';
import i18n from '@src/locales';

export default {
  name: 'projectTypeViewWorkLog',
  props: {
    fields: {
      type: Array,
      default: () => [],
    },
    form: {
      type: Object,
      default: () => ({}),
    },
  },
  setup() {
    const state = reactive({
      visible: false,
    });

    const dialogTitle = i18n.t('common.projectManage.detail.workLog.title3')

    const openDialog = () => {
      state.visible = true;
    };

    const closeDialog = () => {
      state.visible = false;
    };

    return {
      dialogTitle,
      ...toRefs(state),
      openDialog,
      closeDialog,
    };
  },
};
</script>
<style lang="scss" scoped>
</style>